package Test;

import static org.junit.Assert.*;

import java.util.Random; 

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;

import algebra.Complex;

public class PerformanceTest {

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void complexTest() {		
		Random rand = new Random();
		
		int n = 1000000;
		double[] reell = new double[n];
		Complex[] comp = new Complex[n];
		for (int i = 0; i < n; i++) {
			reell[i] = rand.nextDouble();
			comp[i] = new Complex(rand.nextDouble(), rand.nextDouble());
		}
		
//		double zahl = rand.nextDouble();
		
		double x;
		Complex z;
				
		long start = System.currentTimeMillis();		
		for (int i = 0; i < n/2; i++) {
			z = comp[i].add(comp[2*i]);
		}		
		long stop = System.currentTimeMillis();
		System.out.println(stop-start);
		
		start = System.currentTimeMillis();		
		for (int i = 0; i < n/2; i++) {
			x = reell[i] + reell[2*i];
		}		
		stop = System.currentTimeMillis();
		System.out.println(stop-start);
		
		
		fail("Not yet implemented");
	}

}
